<template>
  <div class="subject_info">
      <img v-for="(item, i) in items" v-if="items" :key="i" v-lazy="item.image" @click="toGoods(item)">
  </div>
</template>

<script>
import { GOODS_SUBJECT } from "@/api/goods";

export default {
  props: {
    subjectId: [Number, String]
  },

  data() {
    return {
      items: null
    };
  },

  created() {
    this.initData();
  },

  methods: {
    initData() {
      this.$reqGet(`${GOODS_SUBJECT}`, {
        id: this.subjectId
      }).then(res => {
        let { items } = res.data.data;
        this.items = items;
      });
    },

    toGoods(item) {
        this.$router.push({ path: `/items/detail/${item.item_id}` });
    }
  },
};
</script>

<style lang="scss" scoped>
.subject_info {
    img {
        width: 100%;
        display: block;
    }
}
</style>
